﻿
Ext.namespace('FantastPlatform', 'FantastPlatform.UI');
FantastPlatform.UI.DutyTelForm = function (config) {
    Ext.apply(this, config);
    this.items = [{
        layout: 'column',
        border: false,
        labelSeparator: '：',
        items: [{
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '单位名称',
                name: 'Station',
                allowBlank: false,
                blankText: " 单位名称不能为空",
                width: 200
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '值班室电话1',
                name: 'Office',
                allowBlank: false,
                blankText: "电话不能为空",
                width: 200
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '值班室电话2',
                name: 'Phone',
                width: 200
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '值班室电话3',
                name: 'Phone1',
                width: 200
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '值班室电话4',
                name: 'Home',
                width: 200
            })]
        }]
    }];

    FantastPlatform.UI.DutyTelForm.superclass.constructor.call(this, {
        bodyStyle: 'padding:5px',
        collapsible: true,
        labelAlign: 'right',
        autoScroll: true,
        border: false
    });
};
Ext.extend(FantastPlatform.UI.DutyTelForm, Ext.form.FormPanel, {
    onRender: function (ct, position) {
        FantastPlatform.UI.DutyTelForm.superclass.onRender.call(this, ct, position);
        if (this.Id && this.Id != 0) {
            this.add(new Ext.form.Hidden({ name: 'Id', value: this.Id }));
            this.form.load({
                url: '../Service/DutyTelService.aspx?Action=Get',
                params: { id: this.Id },
                waitMsg: '正在读取数据...',
                waitTitle: '请稍后...',
                failure: function (form, action) {
                    if (action.failureType != 'client') {
                        showErrorMessage('操作失败', action.result.message, '');
                    }
                }
            });
        }
    }
});

